﻿
/// <reference path="base/framwork.js" />
/// <reference path="widget/iscroll.js" />
/// <reference path="base/jquery.js" />
/// <reference path="base/transit.js" />

$(document).ready(function () {
    var loadBox = $('aside.loadBox');
    var articleBox = $('article');
    icom.orient(init);

    function init() {
        //loadBox.show();
        //iuser.init(userGetted);
        load_handler();
    }

    function userGetted(data) {
        console.log('用户头像：' + data.headimage);
        console.log('用户昵称：' + data.nickname);
        load_handler();
    }

    function load_handler() {
        var loader = new PxLoader();
        loader.addImage('images/obg.jpg');
        //实际加载进度
        loader.addProgressListener(function (e) {
            var per = Math.round(e.completedCount / e.totalCount * 50);
            //loadPer.html(per + '%');
        });
        loader.addCompletionListener(function () {
            init_handler();
            loader = null;
        });
        loader.start();
    }


    function init_handler() {
        console.log('init handler');
        monitor_handler();
        $("footer").load("/module/foot.html");

        $('.tab').on('click', function () {
            if ($(this).hasClass('btn_dan')) {
                $('.dan_info').show();
                $('.wang_info').hide();
            }
            else {
                $('.wang_info').show();
                $('.dan_info').hide();
            }

            $('.tab.on').removeClass('on');
            $(this).addClass('on');
        });

        $('.btn_sumbit').on('click', function () {
            if ($('.btn_dan').hasClass('on')) {
                BornPay();
            }
            else {
                FuturePay();
            }

        })
    }

    //----------------------------------------页面监测代码----------------------------------------
    function monitor_handler() {
        //imonitor.add({obj:$('a.btnTest'),action:'touchstart',category:'首页',label:'测试按钮'});
    }

});
